package com.demo.controller;

import com.demo.bean.ValidationBeanModel;
import io.swagger.annotations.Api;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.DecimalMax;

/**
 * @Author: lixiaodong
 * @Description:  正则表达式
 * @Date: 2022/9/15 15:13
 * @Parms: 
 * @ReturnType: 
 */

@RestController
@Validated
@Api(tags = "正则表达式")
public class JustryDengController {


    @RequestMapping(value = "/test/one")
    public String validatioOne(@Validated ValidationBeanModel.AbcDecimalMax myDecimalMax) {
        System.out.println(myDecimalMax.getMyDecimalMax());
        return "one pass!";
    }

    @RequestMapping(value = "/test/two")
    @Validated
    public String validatioTwo(ValidationBeanModel.AbcDecimalMax myDecimalMax) {
        System.out.println(myDecimalMax.getMyDecimalMax());
        return "two pass!";
    }

    @RequestMapping(value = "/test/three")
    public String validatioThree(ValidationBeanModel.AbcDecimalMax myDecimalMax) {
        System.out.println(myDecimalMax.getMyDecimalMax());
        return "three pass!";
    }

    @RequestMapping(value = "/test/four")
    public String validatioFour(@Validated @DecimalMax(value = "12.3") String myDecimalMax) {
        System.out.println(myDecimalMax);
        return "four pass!";
    }

    @RequestMapping(value = "/test/five")
    @Validated
    public String validatioFive(@DecimalMax(value = "12.3") String myDecimalMax) {
        System.out.println(myDecimalMax);
        return "five pass!";
    }

    @RequestMapping(value = "/test/six")
    @Validated
    public String validatioSix(@DecimalMax(value = "12.3") String myDecimalMax) {
        System.out.println(myDecimalMax);
        return "six pass!";
    }
}

